package bb.lanxing.lib.devices.sgsettingentity.userprofile;

import java.io.Serializable;
import java.nio.ByteBuffer;
import java.util.Calendar;
import java.util.Date;

import kotlin.jvm.internal.Intrinsics;

public final class UserProfile implements Serializable {
    private int ALAHR;
    private int ALASPEED;
    private int FTP;
    private int LTHR;
    private int MAXHR;
    private int birthday;
    private int gender;
    private int height;
    private Long time_zone;
    private int weight;
    private int age;

    public UserProfile(int ftp, int alaspeed, int alahr, int lthr, int maxhr, int birthday,
            int gender, int height, int weight, Long timezone) {
        this.FTP = ftp;
        this.ALASPEED = alaspeed;
        this.ALAHR = alahr;
        this.LTHR = lthr;
        this.MAXHR = maxhr;
        this.birthday = birthday;
        this.gender = gender;
        this.height = height;
        this.weight = weight;
        this.time_zone = timezone;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
/*

    public final Integer component1() {
        return this.FTP;
    }

    public final Long component10() {
        return this.time_zone;
    }

    public final Integer component2() {
        return this.ALASPEED;
    }

    public final Integer component3() {
        return this.ALAHR;
    }

    public final Integer component4() {
        return this.LTHR;
    }

    public final Integer component5() {
        return this.MAXHR;
    }

    public final Integer component6() {
        return this.birthday;
    }

    public final Integer component7() {
        return this.gender;
    }

    public final Integer component8() {
        return this.height;
    }

    public final Integer component9() {
        return this.weight;
    }
*/

    public final UserProfile copy(Integer num, Integer num2, Integer num3, Integer num4, Integer num5, Integer num6,
            Integer num7, Integer num8, Integer num9, Long l) {
        return new UserProfile(num, num2, num3, num4, num5, num6, num7, num8, num9, l);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof UserProfile)) {
            return false;
        }
        UserProfile userProfile = (UserProfile) obj;
        return Intrinsics.areEqual(this.FTP, userProfile.FTP)
                && Intrinsics.areEqual(this.ALASPEED, userProfile.ALASPEED)
                && Intrinsics.areEqual(this.ALAHR, userProfile.ALAHR)
                && Intrinsics.areEqual(this.LTHR, userProfile.LTHR)
                && Intrinsics.areEqual(this.MAXHR, userProfile.MAXHR)
                && Intrinsics.areEqual(this.birthday, userProfile.birthday)
                && Intrinsics.areEqual(this.gender, userProfile.gender)
                && Intrinsics.areEqual(this.height, userProfile.height)
                && Intrinsics.areEqual(this.weight, userProfile.weight)
                && Intrinsics.areEqual(this.time_zone, userProfile.time_zone);
    }

/*    public int hashCode() {
        Integer num = this.FTP;
        int i = 0;
        int hashCode = (num == null ? 0 : num.hashCode()) * 31;
        Integer num2 = this.ALASPEED;
        int hashCode2 = (hashCode + (num2 == null ? 0 : num2.hashCode())) * 31;
        Integer num3 = this.ALAHR;
        int hashCode3 = (hashCode2 + (num3 == null ? 0 : num3.hashCode())) * 31;
        Integer num4 = this.LTHR;
        int hashCode4 = (hashCode3 + (num4 == null ? 0 : num4.hashCode())) * 31;
        Integer num5 = this.MAXHR;
        int hashCode5 = (hashCode4 + (num5 == null ? 0 : num5.hashCode())) * 31;
        Integer num6 = this.birthday;
        int hashCode6 = (hashCode5 + (num6 == null ? 0 : num6.hashCode())) * 31;
        Integer num7 = this.gender;
        int hashCode7 = (hashCode6 + (num7 == null ? 0 : num7.hashCode())) * 31;
        Integer num8 = this.height;
        int hashCode8 = (hashCode7 + (num8 == null ? 0 : num8.hashCode())) * 31;
        Integer num9 = this.weight;
        int hashCode9 = (hashCode8 + (num9 == null ? 0 : num9.hashCode())) * 31;
        Long l = this.time_zone;
        if (l != null) {
            i = l.hashCode();
        }
        return hashCode9 + i;
    }*/

    public String toString() {
        return "UserProfile(FTP=" + this.FTP + ", ALASPEED=" + this.ALASPEED + ", ALAHR=" + this.ALAHR + ", LTHR="
                + this.LTHR + ", MAXHR=" + this.MAXHR + ", birthday=" + this.birthday + ", gender=" + this.gender
                + ", height=" + this.height + ", weight=" + this.weight + ", time_zone=" + this.time_zone + ')';
    }

    public final int getFTP() {
        return this.FTP;
    }

    public final void setFTP(int num) {
        this.FTP = num;
    }

    public final int getALASPEED() {
        return this.ALASPEED;
    }

    public final void setALASPEED(int num) {
        this.ALASPEED = num;
    }

    public final int getALAHR() {
        return this.ALAHR;
    }

    public final void setALAHR(int num) {
        this.ALAHR = num;
    }

    public final int getLTHR() {
        return this.LTHR;
    }

    public final void setLTHR(int num) {
        this.LTHR = num;
    }

    public final int getMAXHR() {
        return this.MAXHR;
    }

    public final void setMAXHR(int num) {
        this.MAXHR = num;
    }

    public final int getBirthday() {
        return this.birthday;
    }

    public final void setBirthday(int num) {
        this.birthday = num;
    }

    public final int getGender() {
        return this.gender;
    }

    public final void setGender(int num) {
        this.gender = num;
    }

    public final int getHeight() {
        return this.height;
    }

    public final void setHeight(int num) {
        this.height = num;
    }

    public final int getWeight() {
        return this.weight;
    }

    public final void setWeight(int num) {
        this.weight = num;
    }

    public final Long getTime_zone() {
        return this.time_zone;
    }

    public final void setTime_zone(Long l) {
        this.time_zone = l;
    }

    /*public final boolean isSetUp() {
        Integer num;
        Integer num2;
        Integer num3;
        Integer num4;
        Integer num5;
        Long l;
        Integer num6 = this.FTP;
        if (num6 != null) {
            Intrinsics.checkNotNull(num6);
            if (num6 >= 0 && (num = this.ALASPEED) != null) {
                Intrinsics.checkNotNull(num);
                if (num >= 0 && (num2 = this.ALAHR) != null) {
                    Intrinsics.checkNotNull(num2);
                    if (num2 >= 0 && (num3 = this.LTHR) != null) {
                        Intrinsics.checkNotNull(num3);
                        if (num3 >= 0 && (num4 = this.MAXHR) != null) {
                            Intrinsics.checkNotNull(num4);
                            if (num4 >= 0 && (num5 = this.ALASPEED) != null) {
                                Intrinsics.checkNotNull(num5);
                                if (num5 >= 0 && (l = this.time_zone) != null) {
                                    Intrinsics.checkNotNull(l);
                                    if (l >= 0) {
                                        return true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return false;
    }
*/
    public final long getBirthdayInSecond() {
        Calendar birthdayCalendarByByteStructs = getBirthdayCalendarByByteStructs();
        if (birthdayCalendarByByteStructs != null) {
            return birthdayCalendarByByteStructs.getTimeInMillis() / 1000;
        }
        return 0L;
    }

    public final void setBirthdayInSecond(long j) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date(j * 1000));
        Intrinsics.checkNotNullExpressionValue(calendar, "calendar");
        setBirthdayByByteStructs(calendar);
    }

    public final byte[] getBirthdayAsByteArray() {
        int intValue;
        ByteBuffer allocate = ByteBuffer.allocate(4);
        Integer num = this.birthday;
        if (num == null || (intValue = num) <= 0) {
            return null;
        }
        allocate.putInt(intValue);
        return allocate.array();
    }

    public final Calendar getBirthdayCalendarByByteStructs() {
        byte[] birthdayAsByteArray = getBirthdayAsByteArray();
        if (birthdayAsByteArray != null) {
            try {
                int i = ((birthdayAsByteArray[0] & 255) << 8) + (birthdayAsByteArray[1] & 255);
                byte b = birthdayAsByteArray[2];
                byte b2 = birthdayAsByteArray[3];
                Calendar calendar = Calendar.getInstance();
                calendar.set(i, b, b2 + 1);
                return calendar;
            } catch (Exception ignored) {
            }
        }
        return null;
    }

    public final void setBirthdayByByteStructs(Calendar calendar) {
        int i = calendar.get(2);
        ByteBuffer allocate = ByteBuffer.allocate(4);
        allocate.putShort((short) calendar.get(1));
        allocate.put((byte) i);
        allocate.put((byte) (calendar.get(5) - 1));
        allocate.flip();
        this.birthday = allocate.getInt();
    }
}
